import React, {PureComponent} from 'react';
import {Modal,Button,Input}from 'antd';
import styles from '../common/PateoTable/TableList.less';
import {formatJson} from "../../utils/utils";
const {TextArea}=Input;

export default class ContentModal extends PureComponent<any, any> {
    render(){
        const { changeVisible, detailModelData,width,title,visible,formatData } = this.props;
        return(
            <Modal
                width={ width }
                title={ title }
                visible={ visible }
                onCancel={() => changeVisible()}
                footer={[<Button key="back" type="primary" size="small" onClick={() => changeVisible()}>返回</Button>,]}
            >
                {
                    formatData&&detailModelData.toString().length<4000?
                    <TextArea
                        autoSize={true}
                        value={formatJson(detailModelData)}
                    />:
                    <p className={styles.breakAll}>{ detailModelData.toString() }</p>}
            </Modal>
        );
    }
}
